<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/28
 * Time: 15:19
 */

namespace app\index\controller;


use think\Controller;

class Curl extends Controller
{
    public function get_info(){

//        实例化curl
        $ch = curl_init();
        $url = 'http://127.0.0.1/kkkkk/public/index.php/admin/index/index';
        $array = ['name'=>'zhangsan','num'=>80];
//所访问的第三方或者接口路径
        curl_setopt($ch, CURLOPT_URL, $url);
//        必须存在的配置
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $array);
        curl_setopt($ch,CURLOPT_POST,1);
//        接收返回的状态
        $response = curl_exec($ch);

        if ($response  === FALSE) {
            echo "cURL 具体出错信息: " . curl_error($ch);
        }
//        $curl_info= curl_getinfo($ch);

//        file_get_contents();
//        file_put_contents();

//        curl  获取数据方式   get   post

        echo $response;
        curl_close($ch);
    }
}